package com.clear.honghefinance.wechat.dto.resp;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * <p>
 * 获取access token VO
 * </p>
 * 参考:https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Get_access_token.html
 * 返回示例:
 * - 正确 {"access_token":"ACCESS_TOKEN","expires_in":7200}
 * - 错误 {"errcode":40013,"errmsg":"invalid appid"}
 */
@Getter
@Setter
public class AccessTokenVO implements Serializable {

    /**
     * 获取到的凭证
     */
    @JsonProperty(value = "access_token", required = true)  // jackson处理JSON数据与实体类字段不一致
    // @SerializedName("access_token")  // gson处理JSON数据与实体类字段不一致
    private String accessToken;

    /**
     * 凭证有效时间，单位：秒
     * 官网描述:目前是7200秒之内的值
     */
    @JsonProperty(value = "expires_in", required = true)
    private Integer expiresIn;

    /**
     * 错误码  请求成功0
     */
    @JsonProperty(value = "errcode", required = true)
    private String errCode;

    /**
     * 错误信息
     */
    @JsonProperty(value = "errmsg", required = true)
    private String errMsg;
}
